/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.tech15.pub.dao;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.tech15.pub.model.*;
import com.tech15.pub.dao.*;
import com.tech15.pub.service.*;
import com.tech15.pub.vo.query.*;

/**
 * @author 胡作正 email:zuozhenghu@sina.com
 * @version 1.0
 * @since 1.0
 */


import static cn.org.rapid_framework.util.ObjectUtils.*;
import org.springframework.stereotype.Repository;

@Repository
public class PubSoftDao extends BaseHibernateDao<PubSoft,java.lang.String>{

	public Class getEntityClass() {
		return PubSoft.class;
	}
	
	public Page findByPageRequest(PageRequest<Map> pageRequest) {
		String sql = "select t from PubSoft t where 1=1 "
				+ "/~ and t.category = '[category]' ~/"
				+ "/~ and t.name = '[name]' ~/"
				+ "/~ and t.ver = '[ver]' ~/"
				+ "/~ and t.memo = '[memo]' ~/"
				+ "/~ order by [sortColumns] ~/";
		return pageQuery(sql,pageRequest);
	}
	
	public Page findPage(PubSoftQuery query) {
		String sql = "select t.*,t1.name as categoryName from Pub_Soft t left join pub_data t1 on t.category=t1.id where 1=1 "
				+ "/~ and t.category = '[category]' ~/"
				+ "/~ and t.name = '[name]' ~/"
				+ "/~ and t.ver = '[ver]' ~/"
				+ "/~ and t.memo = '[memo]' ~/"
				+ "/~ order by [sortColumns] ~/";
		Map map = new HashMap();
		map.put("id", "String");
		map.put("category", "String");
		map.put("name", "String");
		map.put("ver", "String");
		map.put("memo", "String");
		map.put("categoryName", "String");
		return pageSqlQuery(sql, query, map, PubSoft.class);
	}
	

}
